﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Himp.Platform
{
    /// <summary>
    /// 系统菜单
    /// </summary>
    public class Menu : AuditedEntity<Guid>, IMultiTenant, ISoftDelete
    {
        /// <summary>
        /// 菜单名称
        /// </summary>
        public string MenuName { get; set; }

        /// <summary>
        /// 菜单类别
        /// </summary>
        public EnumMenuType MenuType { get; set; }

        /// <summary>
        /// 菜单分类代码
        /// </summary>
        public string? MenuCatgeCodg { get; set; }

        /// <summary>
        /// 菜单分类名称
        /// </summary>
        public string? MenuCatgeName { get; set; }

        /// <summary>
        /// 分组标识
        /// </summary>
        public bool GrpFlag { get; set; }

        /// <summary>
        /// 面包屑导航中隐藏
        /// </summary>
        public bool HideInBreadcrumbFlag { get; set; }

        /// <summary>
        /// 是否快捷菜单项
        /// </summary>
        public bool ShortcutFlag { get; set; }

        /// <summary>
        /// 路由链接
        /// </summary>
        public string? RouteAddr { get; set; }

        /// <summary>
        /// 外部链接
        /// </summary>
        public string? ExternalLink { get; set; }

        /// <summary>
        /// 链接target
        /// </summary>
        public string? ExternalLinkTarget { get; set; }

        /// <summary>
        /// 图标
        /// </summary>
        public string? Icon { get; set; }

        /// <summary>
        /// 菜单中隐藏
        /// </summary>
        public bool HideInMenuFlag { get; set; }

        /// <summary>
        /// 有效标识
        /// </summary>
        public bool ValiFalg { get; set; }

        /// <summary>
        /// 隐藏面包屑
        /// </summary>
        public bool HideFlag { get; set; }

        /// <summary>
        /// 是否允许复用
        /// </summary>
        public bool ReuseFlag { get; set; }

        /// <summary>
        /// 顺序号
        /// </summary>
        public int Srtno { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid? ParentId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Menu? Parent { get; set; }

        /// <summary>
        /// 上级菜单
        /// </summary>
        public List<Menu> Children { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public bool IsDeleted { get ; set ; }

        /// <summary>
        /// 
        /// </summary>
        public string? Acl { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string? ClientId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Menu()
        { 
            
        }

        public Menu(string menuName, EnumMenuType menuType, string icon, string? link
            , string? externalLink, string? target, int srtno
            , Guid? parentId, string acl, string? clientId)
        {
            MenuName = menuName;
            MenuType = menuType;
            Icon = icon;
            RouteAddr = link;
            ExternalLink = externalLink;
            ExternalLinkTarget = target;
            ParentId = parentId;
            Srtno = srtno;
            ClientId = clientId;
            GrpFlag = true;
            ReuseFlag = false;
            HideFlag = false;
            ValiFalg = true;
            HideInMenuFlag = false;
            HideInBreadcrumbFlag = true;
            ShortcutFlag = false;
            Acl = acl;
        }
    }
}
